﻿using PCBase.UIControls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VisionCore
{
    public class PortInfo
    {
        [Category("基本参数"), DisplayName("01.有效"), Description("fale：资料无效；true：资料有效；"), ReadOnly(true)]
        //[EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public bool Enable { get; set; } = false;

        [Category("基本参数"), DisplayName("02.卡匣名称"), Description("该片对应的卡匣名称")]
        [EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string CST_Name { get; set; } = "";

        [Category("基本参数"), DisplayName("03.Lot No"), Description("卡匣 Lot No")]
        [EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string LotNo { get; set; } = "";

        [Category("基本参数"), DisplayName("04.Device Name"), Description("工单名称")]
        [EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string DeviceName { get; set; } = "";

        [Category("基本参数"), DisplayName("05.Device Type"), Description("产品类型")]
        [EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public DeviceType Type { get; set; } =  DeviceType.Frame;

        [Category("基本参数"), DisplayName("06.倒膜标识"), Description("true: 已倒膜 false: 未倒膜")]
        [EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public bool ExcFlag { get; set; } = false;

        [Category("基本参数"), DisplayName("07.Size"), Description("")]
        [EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public WfSize Size { get; set; } = WfSize.Inch_12;

        [Category("基本参数"), DisplayName("10.检测中"), Description("false：未检测；ture：检测中；")]
        //[EditorAttribute(typeof(CommonInputEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public bool Insping { get; set; } = false;

        [Category("基本参数"), DisplayName("11.Map结果"), Description("")]
        [TypeConverter(typeof(PropertiesExpandConverter))]
        public List<MapData> MapDatas { get; set; } = new List<MapData>();
    }

    public class MapData
    {
        public bool Valid { get; set; } = false;

        public ushort MappingRet { get; set; } = 0;

        public bool Presence { get; set; } = false;

        public bool Sel { get; set; } = false;

        /// <summary>
        /// Glass当前位置:1.上ARM; 2.下ARM; 3.Stage; 4.Align; 5.旋转; 6.Buffer
        /// </summary>
        public CHIPPos ChipPos { get; set; } = CHIPPos.Port;

        public bool Inspected { get; set; } = false;

        public int Index { get; set; } = 0;

        public string WaferID { get; set; } = "";

        public DateTime StartDT { get; set; } = DateTime.Now;

        public DateTime EndDT { get; set; } = DateTime.Now;

        public DateTime InDT { get; set; } = DateTime.Now;

        public DateTime OutDT { get; set; } = DateTime.Now;

        public double Yield { get; set; } = 0.0;

        public override string ToString()
        {
            return "...";
        }

        public enum CHIPPos
        {
            Upper,
            Lower,
            Align,
            Port,
            ExcST,
            SortST,
            ExcTR,
            NGPort1,
            NGPort2
        }
    }

    public enum DeviceType
    {
        /// <summary>
        /// 带Ring框架
        /// </summary>
        Frame,
        /// <summary>
        /// WAFER
        /// </summary>
        Whole,
    }

}
